<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>DOM树</title>
	</head>
	<body>
		<p>Hello Word!</p>
		<div id="main">
			<p class="p1">DOM非常有用~~~~</p>
			<p class="p1">不信将来你们会经常用到它！</p>
		</div>
		<script type="text/javascript">
			//DOM树
			//1.获取DOM树中的ID元素
			var main = document.getElementById("main");
			console.log(main);
			var p = main.getElementsByTagName("p");
			console.log(p);
			
			var p1 = document.getElementsByClassName("p1");
			console.log(p1);
		</script>
	</body>
</html>
